﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MyLibrary.API.Security;

namespace FifaChamps.WebUI.Security
{
    public class LoginToken : ILoginToken<Guid>
    {
        public Guid ID
        {
            get;
            set;
        }

        public string Username
        {
            get;
            set;
        }

        public string Password
        {
            get;
            set;
        }

        #region Constructors

        private LoginToken() { }
        private LoginToken(string username, string password) {
            this.Username = username;
            this.Password = password;
        }

        #endregion

        public Guid Authenticate()
        {
            if (this.Username == "FifaAdmin" && this.Password == "FifaChamps")
            {
                this.ID = Guid.NewGuid();
                return this.ID;
            }
            else
            {
                return Guid.Empty;
            }
        }

        public static LoginToken Factory(string username, string password)
        {
            LoginToken token = new LoginToken(username, password);
            return token;
        }
    }
}